package com.itheima.递归;

public class MyFactorialDemo {
    public static void main(String[] args) {
        //5!=5*4*3*2*1;
        int result=getJc(5);    //120
        System.out.println(result);
    }
    private static int getJc(int i){
        //就是一定要找到出口
        if (i==1){
            return 1;
        }else {
            return i*getJc(i-1);
        }
    }

}
